package com.example.compose.retrofit.installInfo

import com.example.compose.Constance
import com.example.compose.retrofit.NetWorkManager
import com.example.compose.utils.LogUtil
import org.json.JSONObject
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response

class UpdateInfo : Callback<JSONObject> {

    fun uploadInstallInfo(){
        NetWorkManager.getRequest().uploadInstallInfo(
            mutableMapOf(
                "app_package" to Constance.AppInformation.packageName(),
                "app_channel" to Constance.AppInformation.channel(),
                "phone_system" to "Android",
                "phone_brands" to Constance.AppInformation.brand(),
                "phone_model" to Constance.AppInformation.model(),
                "phone_system_version" to Constance.AppInformation.release(),
            )
        ).enqueue(this)
    }

    override fun onResponse(call: Call<JSONObject>, response: Response<JSONObject>) {
        LogUtil.e("上传安装信息结果${response.body()}")
    }

    override fun onFailure(call: Call<JSONObject>, t: Throwable) {
        LogUtil.e("上传安装信息失败${t.message}")
    }

}